<?php
namespace app\first\controller;

use service\Category;

/**
 * Class Column
 * @title 栏目相关
 * @url /v1/column
 * @desc  栏目相关
 * @version 1.0
 * @package app\first\column
 */
class Column extends Base{
    public $apiAuth = false;
    protected $extraActionList = [];
    protected $model = null;
    public function __construct(){
        parent::__construct();
        $this->model = new \app\first\model\Column;
    }

    /**
     * @title 获取栏目
     * @method get
     * @route('v1/column/get','get')
     * @return \think\facade\Response|\think\response\Json|\think\response\Jsonp|\think\response\Redirect|\think\response\Xml
     * @throws \think\Exception\DbException
     */
    public function get(){
        $list = $this->model
            ->field('id,title,fid,icon')
            ->where('status','eq',0)
            ->order('sort asc')
            ->select();
        $data = $list->toArray();
        $_list = Category::unlimitedForLevel($data);
//        $_list = array_remove_empty($_list);
        return $this->sendSuccess($_list);
    }
}